﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Worktool
{
    public partial class ReportLiefertmine : Form
    {
        public ReportLiefertmine()
        {
            InitializeComponent();
            this.Text = "Liefertermine: " + Properties.Settings.Default.CurrentDBName; 
        }

        private void ReportLiefertmine_Load(object sender, EventArgs e)
        {
            this.vw_rep_LieferterminlisteSchiffIstTableAdapter.Fill(this.ASCDataSet.vw_rep_LieferterminlisteSchiffIst);
            this.vw_rep_LieferterminlisteTableAdapter.Fill(this.ASCDataSet.vw_rep_Lieferterminliste);
            this.vw_rep_LiefertermineTableAdapter.Fill(this.ASCDataSet.vw_rep_Liefertermine);
            this.reportViewer1.RefreshReport();
            comboBox1.Text = "";
            comboBox2.Text = "";
            this.comboBox1.TextChanged += new System.EventHandler(this.comboBox1_TextChanged);
            this.comboBox2.TextChanged += new System.EventHandler(this.comboBox2_TextChanged);
        }


        private void comboBox1_TextChanged(object sender, EventArgs e)
        {
            try
            {
                vw_rep_LiefertermineBindingSource.Filter = string.Format("ISNULL(LieferungSchiffSoll,'') =  '{0}'", Convert.ToDateTime(comboBox1.Text));
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
            }
        }

        private void comboBox2_TextChanged(object sender, EventArgs e)
        {
            try
            {
                vw_rep_LiefertermineBindingSource.Filter = string.Format("ISNULL(Liefertermin,'') = '{0}'", Convert.ToDateTime(comboBox2.Text));
                this.reportViewer1.RefreshReport();
            }
            catch (Exception ex)
            {
            }
        }
    }
}
